using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Text;

public partial class UtilWeb_Script_UCListaLinks : System.Web.UI.UserControl
{
    #region PROPIEDADES
    private String _Descripcion;
    private String _LinkImagen;
    private Dictionary<String, String> _DicUrl;
    
    public String Descripcion
    {
        get { return _Descripcion; }
        set { _Descripcion = value; }
    }
    public String LinkImagen
    {
        get { return _LinkImagen; }
        set { _LinkImagen = value; }
    }
    public Dictionary<String, String> DicUrl
    {
        get { return _DicUrl; }
        set { _DicUrl = value; }
    }
    
    #endregion

    #region EVENTOS
    protected void Page_Load(object sender, EventArgs e)
    {
        replista.DataSource = DicUrl;
        replista.DataBind();
    }
    protected void replista_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {

            String lsKey = (string)((KeyValuePair<String, string>)e.Item.DataItem).Key;
            String lsValue = (string)((KeyValuePair<String, string>)e.Item.DataItem).Value;
            ((Literal)e.Item.FindControl("litEnlace")).Text = fnUrlNavegacion(lsKey, lsValue);
        }
    }
    #endregion

    #region METODOS
    private String fnUrlNavegacion(String psKey,String psValue)
    {
        String[] lsKeys = psKey.Split('|');
        StringBuilder loSb = new StringBuilder();
        loSb.Append("<li><a href=" + Request.ApplicationPath + psValue + " title='" + lsKeys[0] + "'>" + lsKeys[0] + "</a><span> - " + lsKeys[1] + "</span> </li>");
        return loSb.ToString();
    }
    #endregion
    
}
